package it.unipi.di.rasip.utils;

import java.io.IOException;
import java.util.Hashtable;

import javax.microedition.lcdui.Image;


public class IconsFactory {
	public static final String LOGO = "web.png";
	public static final String SIP_ICON2 = "sip16.png";
	public static final String SIP_ICON = "sip22.png";
	public static final String SKYPE_ICON = "skype.png";
	public static final String ALERT = "alert.png";

	private static String iconsDirectory = "/res/icons/";
	public static Hashtable icons = new Hashtable();
	
	public static Image createIcon(String description) {
		Image toRet = (Image) icons.get(description);
		if (toRet == null) {
		try {
			toRet = Image.createImage( iconsDirectory + description );
			icons.put(description, toRet);
			
		} catch (IOException e) {
			toRet = null;
			System.err.println( "ERROR: createIcon(\"" +iconsDirectory+ description + "\")" );
			e.printStackTrace();
		} 
		}
		return toRet;
	}

}
